package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

class zjo {
   private Chart b;
   private zafz c;
   private zif d;
   private zig e;
   private ImageOrPrintOptions f;
   private Workbook g;
   private boolean h = false;
   private boolean i = true;
   private boolean j = false;
   boolean a = false;
   private boolean k = false;

   zjo(ImageOrPrintOptions var1) {
      this.f = var1;
      if (this.f == null) {
         this.f = new ImageOrPrintOptions();
      }

   }

   private boolean e(Chart var1) {
      if (var1.getChartObject().getHeight() != 0 && var1.getChartObject().getWidth() != 0) {
         switch(var1.getType()) {
         case 69:
         case 70:
         case 71:
         case 72:
            return false;
         default:
            return true;
         }
      } else {
         return false;
      }
   }

   private zn a(Chart var1, com.aspose.cells.b.a.d.zm var2, ImageFormat var3) throws Exception {
      this.f(var1);
      this.c.a(var3);
      int var4 = zadb.b;
      com.aspose.cells.b.a.b.zs var5 = this.c.T();
      zn var6 = zadb.a(var4, var5.b(), var5.c(), var3, this.f, var2, this.c);
      return var6;
   }

   com.aspose.cells.b.a.b.za a(Chart var1) throws Exception {
      if (!this.e(var1)) {
         return null;
      } else {
         ImageFormat var2 = ImageFormat.getBmp();
         zn var3 = this.a((Chart)var1, (com.aspose.cells.b.a.d.zm)null, (ImageFormat)var2);
         if (var3 != null) {
            com.aspose.cells.b.a.b.za var4 = var3.m();
            return var4;
         } else {
            return null;
         }
      }
   }

   void a(com.aspose.cells.b.a.d.zm var1, Chart var2) throws Exception {
      if (this.e(var2)) {
         ImageFormat var3 = this.f.getImageFormat();
         zn var4 = this.a(var2, var1, var3);
         if (var4 != null) {
            var4.l();
         }

      }
   }

   com.aspose.cells.a.d.zb b(Chart var1) throws Exception {
      if (!this.e(var1)) {
         return null;
      } else {
         zafz var2 = this.f(var1);
         int var3 = zadb.b;
         zap var4 = (zap)zadb.a(var3, this.c.T().b(), this.c.T().c(), ImageFormat.getBmp(), (ImageOrPrintOptions)null, (com.aspose.cells.b.a.d.zm)null, var2);
         return var4.n();
      }
   }

   zif c(Chart var1) throws Exception {
      if (!this.e(var1)) {
         return null;
      } else {
         ImageFormat var2 = ImageFormat.getBmp();
         this.a((Chart)var1, (com.aspose.cells.b.a.d.zm)null, (ImageFormat)var2);
         this.d.am();
         return this.d;
      }
   }

   zig d(Chart var1) throws Exception {
      if (!this.e(var1)) {
         return null;
      } else {
         ImageFormat var2 = ImageFormat.getBmp();
         this.a((Chart)var1, (com.aspose.cells.b.a.d.zm)null, (ImageFormat)var2);
         this.e.am();
         return this.e;
      }
   }

   private zafz f(Chart var1) throws Exception {
      this.g = var1.j().n();
      if (var1.H() == 2) {
         this.i = false;
      } else if (var1.H() == 1) {
         this.i = true;
      } else {
         this.i = this.g.j();
      }

      this.b = var1;
      this.h = var1.getPivotSource() != null && var1.getPivotSource().length() > 0;
      if (this.h && var1.getNSeries().getCount() == 0) {
         var1.refreshPivotData();
      }

      this.j = var1.J();
      com.aspose.cells.b.a.b.zg var2 = null;
      Color var3 = Color.getEmpty();
      var2 = this.a(var1.getChartArea().getFont());
      if (!var1.getChartArea().getFont().b.a() && !var1.getChartArea().getFont().getColor().isEmpty()) {
         if (var1.getChartArea().getFont().getColor().getA() == 0) {
            var3 = Color.fromArgb(var1.getChartArea().getFont().getColor().toArgb() | -16777216);
         } else {
            var3 = var1.getChartArea().getFont().getColor();
         }
      }

      if (this.i) {
         this.e = new zig(var2, var3);
         this.c = this.e;
      } else {
         this.d = new zif(var2, var3);
         this.c = this.d;
      }

      this.c.a(zakq.b());
      this.c.h(this.b.k().a().c().n().getSettings().getDate1904());
      this.c();
      this.e();
      this.h();
      if (this.i) {
         this.a(var1, this.e);
      } else {
         this.a(var1, this.d);
      }

      this.d();
      this.c.i(zsu.a(var1.j()));
      this.c.j(this.b.d);
      this.b.d = false;
      return this.c;
   }

   private void c() throws Exception {
      this.c.a(this.b.j().n().getSettings().e());
      this.c.j(this.b.a());
      if (this.c.R() == -1) {
         this.c.j(2);
      }

      this.a(this.b.j().n());
      this.c.i(zjm.i(this.b.getType()));
      this.c.e(this.b.isRectangularCornered());
      this.f();
      this.g();
      this.i();
      this.k();
      if (this.i) {
         if (this.b.n() != null && (!this.b.getTitle().I() || this.b.getTitle().getText() != null && !"".equals(this.b.getTitle().getText()))) {
            this.a(this.b.getTitle(), this.c.L(), true);
         }
      } else {
         String var1;
         if (this.b.n() == null) {
            if (this.b.getNSeries().getCount() == 1 && this.b.getNSeries().get(0).getName() != null) {
               var1 = this.a(this.b.getNSeries().get(0));
               if (var1 != null) {
                  this.c.L().a(var1);
               }
            }
         } else if (this.b.getTitle().getText() == null) {
            if (this.b.getTitle().isAutoText() && this.b.getNSeries().getCount() == 1 && this.b.getNSeries().get(0).getName() != null) {
               var1 = this.a(this.b.getNSeries().get(0));
               if (var1 != null) {
                  this.c.L().a(var1);
                  this.a(this.b.getTitle(), this.c.L(), true);
               }
            }
         } else if (!"".equals(this.b.getTitle().getText())) {
            this.a(this.b.getTitle(), this.c.L(), true);
         }
      }

      if (ChartCollection.b(this.b.getType())) {
         this.c.d(this.b.getGapDepth());
         this.c.e(this.b.getGapWidth());
         this.c.f(this.b.getElevation());
         this.c.h(this.b.getRotationAngle());
         this.c.a(this.b.getAutoScaling());
         this.c.b(this.b.getRightAngleAxes());
         this.c.c(this.b.getDepthPercent());
         this.c.g(this.b.getHeightPercent());
         if (this.b.s() != null) {
            this.a(this.b.getFloor(), this.c.t());
         }

         if (this.b.t() != null) {
            this.a(this.b.getWalls(), this.c.O());
         }

         if (this.b.u() != null) {
            this.a(this.b.getBackWall(), this.c.P());
         } else if (this.b.t() != null) {
            this.a(this.b.getWalls(), this.c.P());
         }

         if (this.b.w() != null) {
            this.a(this.b.getSideWall(), this.c.Q());
         } else if (this.b.t() != null) {
            this.a(this.b.getWalls(), this.c.Q());
         }
      }

   }

   private void d() throws Exception {
      Iterator var1 = this.b.getShapes().iterator();

      while(var1.hasNext()) {
         Shape var2 = (Shape)var1.next();
         if (var2.getMsoDrawingType() == 5) {
            ChartShape var3 = (ChartShape)var2;
            Chart var4 = var3.a();
            zjo var5 = new zjo(this.f);
            zafz var6 = var5.f(var4);
            var6.i(false);
            var6.a(var2.getLeft());
            var6.b(var2.getTop());
            this.c.W().a(var6);
         }
      }

   }

   private void e() throws Exception {
      this.l();
      int var1 = 0;
      ArrayList var2 = new ArrayList();
      Iterator var3 = this.b.m().iterator();

      while(var3.hasNext()) {
         ziz var4 = (ziz)var3.next();
         Iterator var5 = this.b.getNSeries().iterator();

         while(var5.hasNext()) {
            Series var6 = (Series)var5.next();
            if (var6.t() && var6.s() == var4) {
               zbnt var7 = new zbnt(var6);
               var7.a(var1);
               ++var1;
               com.aspose.cells.b.a.a.ze.a(var2, (Object)var7);
            }
         }
      }

      Collections.sort(var2);

      for(int var8 = 0; var8 < var2.size(); ++var8) {
         zbnt var9 = (zbnt)var2.get(var8);
         int var10 = zjm.i(var9.b().getType());
         zahv var11 = this.c.A().b(var10);
         var11.l(var9.a());
         this.a(var9.b(), var11);
         if (var11.k().getCount() == 0) {
            this.c.A().removeAt(this.c.A().getCount() - 1);
         } else if (var9.b().getTrendLines() != null && var9.b().getTrendLines().getCount() > 0) {
            this.a(var11, var9.b());
         }
      }

   }

   private void a(Series var1, zahv var2) throws Exception {
      var2.d(zjm.C(var1.getBar3DShapeType()));
      String var3 = null;
      boolean var4 = false;
      String var5 = this.a(var1);
      if (var5 != null) {
         var2.a(var5);
      }

      if (var1.l() != null) {
         boolean var6 = false;
         boolean[] var8 = new boolean[]{var6};
         ArrayList var7 = var1.l().a(true, this.h || this.j, var8);
         var6 = var8[0];
         if (var7 != null && var7.size() != 0) {
            int var16;
            for(var16 = 0; var16 < var7.size(); ++var16) {
               zit var9 = (zit)var7.get(var16);
               if (!this.b.getPlotVisibleCells() || var9.d) {
                  double var10 = 0.0D;
                  double[] var12 = new double[]{var10};
                  this.a(var9, var12);
                  var10 = var12[0];
                  zagd var13 = var2.k().a(var10);
                  var13.b(var9.a);
                  var13.b(zjm.J(var9.g));
                  var3 = var9.c;
                  if ((var3 == null || "".equals(var3)) && var9.b != 0) {
                     var3 = this.g.getSettings().e().d(var9.b);
                  }

                  var13.b(var3);
                  var13.g(var4);
                  if (var9.e) {
                     if (this.b.getPlotEmptyCellsType() == 0) {
                        var13.a(true);
                     } else if (this.b.getPlotEmptyCellsType() == 2) {
                        var13.c(true);
                        var13.a(true);
                     }
                  }

                  if (var9.g == 2) {
                     var13.e(true);
                  }
               }
            }

            boolean var17;
            int var19;
            if (ChartCollection.k(var1.getType()) || ChartCollection.q(var1.getType())) {
               var17 = false;
               if (var1.m() == null) {
                  var17 = true;
               } else {
                  boolean[] var18 = new boolean[]{var6};
                  var7 = var1.m().a(true, this.h || this.j, var18);
                  var6 = var18[0];
                  var19 = 0;

                  for(int var20 = 0; var20 < var7.size() && var19 < var2.k().getCount(); ++var20) {
                     zit var11 = (zit)var7.get(var20);
                     if (!this.b.getPlotVisibleCells() || var11.d) {
                        double var24 = 0.0D;
                        double[] var14 = new double[]{var24};
                        this.a(var11, var14);
                        var24 = var14[0];
                        zagd var15 = var2.k().a(var19);
                        ++var19;
                        var15.a(var24);
                        var15.a(var11.a);
                        var15.a(zjm.J(var11.g));
                        var3 = var11.c;
                        if ((var3 == null || "".equals(var3)) && var11.b != 0) {
                           var3 = this.g.getSettings().e().d(var11.b);
                        }

                        var15.a(var3);
                        var15.f(var4);
                        if (var11.g == 2) {
                           var15.d(true);
                        }

                        if (var11.e && this.b.getPlotEmptyCellsType() == 0) {
                           var15.b(true);
                        } else {
                           switch(var11.g) {
                           case 2:
                              var15.b(true);
                           case 3:
                           case 4:
                           default:
                              break;
                           case 5:
                           case 6:
                              var17 = true;
                           }
                        }
                     }
                  }
               }

               if (var17) {
                  for(var19 = 0; var19 < var2.k().getCount(); ++var19) {
                     zagd var22 = var2.k().a(var19);
                     var22.b(false);
                     var22.d(false);
                     var22.a((double)(var19 + 1));
                  }

                  if (ChartCollection.q(var1.getType())) {
                     this.c.f().c(1.0D);
                  }
               }
            }

            if (ChartCollection.q(var1.getType()) && var1.n() != null) {
               var2.j(var1.getBubbleScale());
               var2.i(var1.getShowNegativeBubbles());
               var2.k(zjm.e(var1.getSizeRepresents()));
               var8 = new boolean[]{var6};
               var7 = var1.n().a(true, this.h || this.j, var8);
               var6 = var8[0];
               var16 = 0;

               for(var19 = 0; var19 < var7.size() && var16 < var2.k().getCount(); ++var19) {
                  zit var23 = (zit)var7.get(var19);
                  if (!this.b.getPlotVisibleCells() || var23.d) {
                     double var21 = 0.0D;
                     double[] var25 = new double[]{var21};
                     this.a(var23, var25);
                     var21 = var25[0];
                     zagd var27 = var2.k().a(var16);
                     ++var16;
                     var27.e(var21);
                     var3 = var23.c;
                     if ((var3 == null || "".equals(var3)) && var23.b != 0) {
                        var3 = this.g.getSettings().e().d(var23.b);
                     }

                     var27.c(var3);
                     var27.h(var4);
                  }
               }
            }

            if (this.b(var1.getType())) {
               this.a(var1.getMarker(), var2.h());
            }

            if (var1.d() != null) {
               this.a(var1.getArea(), var2.g());
            } else if (var1.s().h() != null) {
               this.a(var1.s().h(), var2.g());
            }

            if (var1.e() != null) {
               this.a(var1.getBorder(), var2.f());
            } else if (var1.s().g() != null) {
               this.a(var1.s().g(), var2.f());
            }

            var17 = false;
            if (var1.b() != null) {
               var17 = true;

               for(var19 = 0; var19 < var2.k().getCount(); ++var19) {
                  this.a(var1, var2.k().a(var19), var19);
               }

               if (this.b.getType() == 49 || this.b.getType() == 46) {
                  this.a(var1, var2.b(), var2.k().getCount());
               }
            } else if (var1.e() != null && !var1.getBorder().isAuto() || var1.d() != null && var1.getArea().getFormatting() != 0 || var1.u() != null && var1.getMarker().getMarkerStyle() != 0 || var1.u() != null && var1.getMarker().getBorder().getFormattingType() != 0 || var1.u() != null && var1.getMarker().getArea().getFormatting() != 0) {
               var17 = true;

               for(var19 = 0; var19 < var2.k().getCount(); ++var19) {
                  this.a(var1, var2.k().a(var19));
               }

               if (this.b.getType() == 49 || this.b.getType() == 46) {
                  this.a(var1, var2.b());
               }
            }

            if (var2.h().d() != 1) {
               switch(var2.m()) {
               case 62:
                  var2.c(61);
                  break;
               case 64:
                  var2.c(63);
               }
            }

            var2.a(var1.getPlotOnSecondAxis());
            var2.c(var1.isColorVaried());
            if (var1.p() != null) {
               this.a(var1.getDataLabels(), var2.c(), var1.getType());
               if (!var17) {
                  for(var19 = 0; var19 < var2.k().getCount(); ++var19) {
                     this.a(var1.getDataLabels(), var2.k().a(var19).p(), var1.getType());
                  }
               }
            }

            if (var1.w() != null) {
               this.a(var1.getXErrorBar(), var2.e());
            }

            if (var1.x() != null) {
               this.a(var1.getYErrorBar(), var2.d());
            }

            var2.b(var1.getSmooth());
            var2.d(var1.hasDropLines());
            if (var1.hasDropLines()) {
               this.a(var1.getDropLines(), var2.n());
            }

            var2.e(var1.hasHiLoLines());
            if (var1.hasHiLoLines()) {
               this.a(var1.getHiLoLines(), var2.o());
            }

            var2.g(var1.hasLeaderLines());
            if (var1.hasLeaderLines()) {
               this.a(var1.getLeaderLines(), var2.p());
            }

            var2.f(var1.hasUpDownBars());
            if (var1.hasUpDownBars()) {
               this.a(var1.getUpBars(), var2.q());
               this.a(var1.getDownBars(), var2.r());
            }

            var2.e(var1.getGapWidth());
            var2.f(var1.getOverlap());
            var2.g(var1.getFirstSliceAngle());
            var2.h(var1.getDoughnutHoleSize());
            var2.i(var1.getSecondPlotSize());
            if (!var1.y()) {
               var2.a((float)var1.getExplosion());
            }

            if (!var1.isAutoSplit()) {
               var2.m(zjm.I(var1.getSplitType()));
               var2.a(var1.getSplitValue());
            } else {
               var2.m(0);
            }

            var2.h(var1.hasSeriesLines());
            if (var1.hasSeriesLines()) {
               this.a(var1.getSeriesLines(), var2.s());
            }

            var2.a(var1.a());
            var2.b(var1.B());
            if (!this.i) {
               var2.j(var1.C());
            }

            var2.k(var1.getShadow());
            ArrayList var26 = zbuk.a(var2.i(), this.b.getChartArea().getFont(), false);
            zbuk.a(var26, var2.t(), this.c.j().h(), this.c.j().j(), this.c.j().k());
         }
      }
   }

   private void a(Series var1, zagd var2) throws Exception {
      Line var3 = var1.e() == null ? var1.s().g() : var1.e();
      if (var3 != null) {
         this.a(var3, var2.l());
      }

      Area var4 = var1.d() == null ? var1.s().h() : var1.d();
      if (var4 != null) {
         this.a(var4, var2.j());
      }

      Marker var5 = var1.u() == null ? var1.s().f() : var1.u();
      if (var5 != null) {
         this.a(var5, var2.n());
      }

      DataLabels var6 = var1.p();
      if (var6 != null) {
         this.a(var6, var2.p(), var1.getType());
      }

      var2.i(var1.getShadow());
   }

   private void a(Series var1, zagd var2, int var3) throws Exception {
      ChartPoint var4 = var1.getPoints().b(var3);
      Line var5;
      Area var6;
      Marker var7;
      DataLabels var8;
      if (var4 == null) {
         var2.i(var1.getShadow());
         var5 = var1.e();
         if (var5 == null) {
            var5 = var1.s().g();
         }

         if (var5 != null) {
            this.a(var5, var2.l());
         }

         var6 = var1.d();
         if (var6 == null) {
            var6 = var1.s().h();
         }

         if (var6 != null) {
            this.a(var6, var2.j());
         }

         var7 = var1.u();
         if (var7 == null) {
            var7 = var1.s().f();
         }

         if (var7 != null) {
            this.a(var7, var2.n());
         }

         var8 = var1.p();
         if (var8 != null) {
            this.a(var8, var2.p(), var1.getType());
         }
      } else {
         var2.i(var4.getShadow());
         if (!var4.d()) {
            var2.a((float)var4.getExplosion());
         }

         var5 = var4.f() == null ? var1.e() : var4.f();
         if (var5 == null) {
            var5 = var1.s().g();
         }

         if (var5 != null) {
            this.a(var5, var2.l());
         }

         var6 = var4.g() == null ? var1.d() : var4.g();
         if (var6 == null) {
            var6 = var1.s().h();
         }

         if (var6 != null) {
            this.a(var6, var2.j());
         }

         var7 = var4.h() == null ? var1.u() : var4.h();
         if (var7 == null) {
            var7 = var1.s().f();
         }

         if (var7 != null) {
            this.a(var7, var2.n());
         }

         var8 = var4.j() == null ? var1.p() : var4.j();
         if (var8 != null) {
            this.a(var8, var2.p(), var1.getType());
         }
      }

   }

   private void f() throws Exception {
      this.a((ChartFrame)this.b.getChartArea(), (zagc)this.c.j());
      this.c.j().a(this.b.getChartObject().getWidth());
      this.c.j().b(this.b.getChartObject().getHeight());
   }

   private void g() throws Exception {
      this.a((ChartFrame)this.b.getPlotArea(), (zagc)this.c.C());
      if ((this.b.h() & 255 & 24) == 24) {
         this.c.C().c(this.b.getPlotArea().m());
         this.c.C().d(this.b.getPlotArea().n());
         this.c.C().a(this.b.getPlotArea().getWidth());
         this.c.C().b(this.b.getPlotArea().getHeight());
      }

      this.c.f(this.b.getPlotArea().isInnerMode());
      if (this.b.getPlotArea().isInnerMode() && (!this.b.getPlotArea().i() || !this.b.getPlotArea().l())) {
         this.c.C().a(false);
         this.c.C().c(this.b.getPlotArea().getInnerX());
         this.c.C().d(this.b.getPlotArea().getInnerY());
         this.c.C().a(this.b.getPlotArea().getInnerWidth());
         this.c.C().b(this.b.getPlotArea().getInnerHeight());
      }

   }

   private void h() throws Exception {
      this.a(this.b.getCategoryAxis(), this.c.f());
      this.a(this.b.getValueAxis(), this.c.F());
      this.a(this.b.getSecondCategoryAxis(), this.c.h());
      this.a(this.b.getSecondValueAxis(), this.c.H());

      for(int var1 = 0; var1 < this.b.c.getCount(); ++var1) {
         ziz var2 = this.b.c.a(var1);
         if (ChartCollection.o(var2.j())) {
            if (var2.m()) {
               if (!var2.L()) {
                  this.c.h().j(3);
               }
            } else if (!var2.L()) {
               this.c.f().j(3);
            }
         }
      }

      if (this.g(this.b)) {
         this.a(this.b.getSeriesAxis(), this.c.J());
      }

   }

   private void a(Axis var1, zafo var2) throws Exception {
      var2.d(var1.isVisible());
      var2.a(var1.d);
      var2.a(var1.getAxisBetweenCategories());
      if (!this.i && var1.b() == 2) {
         var2.a(true);
      }

      if (var1.i() != null) {
         this.a(var1.getAxisLine(), var2.h());
      }

      var2.d(zjm.h(var1.getCategoryType()));
      if (var1.getCategoryType() != 1) {
         var2.e(var1.isBaseUnitAuto());
         if (!var1.isBaseUnitAuto()) {
            var2.c(zjm.f(var1.getBaseUnitScale()));
         }

         var2.g(zjm.f(var1.getMajorUnitScale()));
         var2.i(zjm.f(var1.getMinorUnitScale()));
      }

      var2.e(zjm.g(var1.getCrossType()));
      if (var1.getCrossType() == 2) {
         var2.a(var1.getCrossAt());
      } else if (var1.getCrossType() == 0 && var1.isLogarithmic()) {
         var2.a(1.0D);
      }

      var2.b(var1.isLogarithmic());
      var2.b(var1.getLogBase());
      var2.c(var1.isPlotOrderReversed());
      var2.i(var1.g());
      if (!var1.g()) {
         var2.c(this.a(var1.getMajorUnit()));
      }

      var2.j(var1.h());
      if (!var1.h()) {
         var2.e(this.a(var1.getMinorUnit()));
      }

      var2.h(var1.f());
      if (!var1.f()) {
         if (var1.getMaxValue() instanceof DateTime) {
            var2.d(CellsHelper.getDoubleFromDateTime((DateTime)var1.getMaxValue(), this.b.k().a().c().n().getSettings().getDate1904()));
         } else {
            var2.d(this.a((Double)var1.getMaxValue()));
         }
      }

      var2.g(var1.e());
      if (!var1.e()) {
         if (var1.getMinValue() instanceof DateTime) {
            var2.f(CellsHelper.getDoubleFromDateTime((DateTime)var1.getMinValue(), this.b.k().a().c().n().getSettings().getDate1904()));
         } else {
            var2.f(this.a((Double)var1.getMinValue()));
         }
      }

      if (var1.o() != null) {
         this.a(var1.getMajorGridLines(), var2.t());
      } else {
         var2.t().a(0);
      }

      if (var1.p() != null) {
         this.a(var1.getMinorGridLines(), var2.v());
      } else {
         var2.v().a(0);
      }

      if (var1.n() != null && (var1.getTitle().getText() != null && !"".equals(var1.getTitle().getText()) || var1.getTitle().isAutoText())) {
         this.a(var1.getTitle(), var2.L(), false);
      }

      if (var1.j()) {
         var2.f(zjm.q(var1.getMajorTickMark()));
         var2.h(zjm.q(var1.getMinorTickMark()));
         var2.j(zjm.p(var1.getTickLabelPosition()));
         var2.f(var1.l());
         if (!var1.l()) {
            var2.k(var1.getTickLabelSpacing());
         } else if (this.i && !var2.O() && "dateAx".equals(var1.d)) {
            var2.k(com.aspose.cells.b.a.ze.f(var2.x()));
            var2.f(false);
         }

         var2.l(var1.getTickMarkSpacing());
         if (var1.k() != null) {
            this.a(var1, var1.getTickLabels(), var2.G());
         }
      }

      if (var1.getDisplayUnit() != 0) {
         var2.R().a(zjm.a(var1.getDisplayUnit()));
         if (var2.R().d() == -11) {
            var2.R().b(var1.getCustUnit());
         }

         if (var1.isDisplayUnitLabelShown()) {
            var2.R().c(true);
            this.a(var1.getDisplayUnitLabel(), var2.R());
         } else {
            var2.R().c(false);
         }
      }

      if (var1.d() != null) {
         this.a(var1.getArea(), var2.i());
      }

   }

   private void i() throws Exception {
      if (!this.b.getShowLegend()) {
         this.c.d(false);
      } else {
         this.c.d(true);
         if (this.b.p() != null) {
            Legend var1 = this.b.getLegend();
            zahc var2 = this.c.y();
            var2.a(var1.B());
            this.a((ChartFrame)var1, (zagc)var2.a());
            var2.a(zjm.n(var1.getPosition()));
            var2.b(var1.isOverLay());
            var2.a().e(var1.l());
            var2.a().c(var1.j());
            var2.a().d(var1.k());
            if (!this.i && var1.getPosition() == 3 && !var2.a().q() && this.b.getPlotArea().l() && this.b.getPlotArea().i()) {
               var2.a().c(true);
            }

            if (!var1.l()) {
               var2.a().a(var1.getWidth());
               var2.a().b(var1.getHeight());
            }

            if (var1.A() != null) {
               this.j();
            }

         }
      }
   }

   private void j() throws Exception {
      Legend var1 = this.b.getLegend();
      zahc var2 = this.c.y();

      for(int var3 = 0; var3 < var1.getLegendEntries().getCount(); ++var3) {
         LegendEntry var4 = var1.getLegendEntries().b(var3);
         zahe var5 = var2.b().a(var4.c());
         var5.a(this.a(var4.getFont()));
         if (this.b(var4.getFont())) {
            this.a(var4.getFont(), var5.a());
         }

         if (!var4.getFont().getColor().isEmpty()) {
            if (var4.getFont().getColor().getA() == 0) {
               var5.a(Color.fromArgb(var4.getFont().getColor().toArgb() | -16777216));
            } else {
               var5.a(var4.getFont().getColor());
            }
         }

         var5.a(var4.isDeleted());
      }

   }

   private void k() throws Exception {
      this.c.c(this.b.getShowDataTable());
      if (this.b.getShowDataTable()) {
         ChartDataTable var1 = this.b.getChartDataTable();
         zagb var2 = this.c.l();
         this.a(var1.getBorder(), var2.e());
         if (var1.a() != null || var1.b() != -1) {
            var2.a(this.a(var1.getFont()));
            if (!var1.getFont().getColor().isEmpty()) {
               var2.a(this.a(var1.getFont().getColor()));
            }
         }

         var2.c(var1.hasBorderHorizontal());
         var2.a(var1.getShowLegendKey());
         var2.d(var1.hasBorderOutline());
         var2.b(var1.hasBorderVertical());
      }
   }

   private void a(Chart var1, zig var2) throws Exception {
      if (var1.l() != null && var1.l().getCount() != 0) {
         Iterator var3 = var1.getShapes().iterator();

         while(var3.hasNext()) {
            Shape var4 = (Shape)var3.next();
            if (!var4.isHidden() && var4.getMsoDrawingType() != 5) {
               zbkr var5 = var2.ab().b(zbma.c(var4.getMsoDrawingType()));
               zbma.a(var4, var5);
            }
         }

      }
   }

   private void a(Chart var1, zif var2) throws Exception {
      if (var1.l() != null && var1.l().getCount() != 0) {
         int var3 = zhz.c;
         Iterator var4 = var1.getShapes().iterator();

         while(var4.hasNext()) {
            Shape var5 = (Shape)var4.next();
            if (!var5.isHidden() && var5.getMsoDrawingType() != 5) {
               zbkq var6 = var2.V().b(zblz.c(var5.getMsoDrawingType()));
               zblz.a(var5, var6);
               byte var7 = 0;
               byte var8 = 0;
               byte var9 = 0;
               byte var10 = 0;
               int[] var11 = new int[]{var7};
               int[] var12 = new int[]{var8};
               int[] var13 = new int[]{var9};
               int[] var14 = new int[]{var10};
               var5.a(var11, var12, var13, var14);
               int var19 = var11[0];
               int var20 = var12[0];
               int var21 = var13[0];
               int var22 = var14[0];
               com.aspose.cells.b.a.b.zp var15 = new com.aspose.cells.b.a.b.zp(var19, var20, var21 - var19, var22 - var20);
               com.aspose.cells.b.a.b.zp var16 = com.aspose.cells.b.a.b.zp.a();
               int var17 = var2.a() - 2 * var3;
               int var18 = var2.b() - 2 * var3;
               if (var17 < 0) {
                  var17 = 0;
               }

               if (var18 < 0) {
                  var18 = 0;
               }

               var16.a((int)((float)(var15.g() * var17) / 4000.0F) + var3);
               var16.b((int)((float)(var15.h() * var18) / 4000.0F) + var3);
               var16.c((int)((float)(var15.e() * var17) / 4000.0F));
               var16.d((int)((float)(var15.f() * var18) / 4000.0F));
               var6.c((float)var16.c());
               var6.d((float)var16.d());
               var6.a((float)var16.e());
               var6.b((float)var16.f());
            }
         }

      }
   }

   private ArrayList[] a(boolean var1, zik var2, zafs var3, boolean[] var4) {
      byte var5 = 1;
      boolean var6 = false;
      var4[0] = true;

      for(int var7 = 0; var7 < this.b.getNSeries().getCount(); ++var7) {
         Series var8 = this.b.getNSeries().get(var7);
         zik var9 = this.b.getNSeries().get(var7).l();
         if (var8.getPlotOnSecondAxis() == var1 && var9 != null && var9.c()) {
            var6 = true;
            break;
         }
      }

      int[] var22 = new int[]{var5};
      ArrayList var23 = var2.a(var6, this.h || this.j, var22);
      int var21 = var22[0];
      if (var23 != null && var23.size() != 0) {
         if (var21 == 1) {
            boolean var25 = this.a(var23);

            for(int var26 = 0; var26 < var23.size(); ++var26) {
               zit var28 = (zit)var23.get(var26);
               if (!this.b.getPlotVisibleCells() || var28.d) {
                  Object var29 = var28.a;
                  if (var25 && var28.a != null) {
                     String var30 = var28.c;
                     if (var30 != null && "".equals(var30)) {
                        var30 = null;
                     }

                     zxz var32 = this.g.getSettings().e().a(var30, var28.a, false);
                     var29 = var32.h();
                  }

                  zafr var31 = var3.a(var29);
                  var31.c(var28.e);
                  var31.a(var28.c);
                  if (var28.g == 1) {
                     var31.b(var28.f);
                  }

                  if (var28.b != 0) {
                     var31.a(this.g.getSettings().e().d(var28.b));
                  }
               }
            }

            var4[0] = var3.getCount() != 0;
            if (!var4[0]) {
               zafr var27 = var3.a("");
               var27.c(true);
            }

            return null;
         } else {
            int var24 = var23.size();
            ArrayList[] var10 = new ArrayList[var24];
            ArrayList[] var11 = new ArrayList[var24];

            int var12;
            for(var12 = 0; var12 < var11.length; ++var12) {
               var10[var12] = (ArrayList)var23.get(var12);
               var11[var12] = new ArrayList();
            }

            var10[var24 - 1] = (ArrayList)var23.get(var24 - 1);
            var12 = var10[0].size();
            ArrayList var14 = null;
            zafr var15 = null;
            boolean var16 = false;

            for(int var17 = 0; var17 < var12; ++var17) {
               var16 = false;

               for(int var19 = 0; var19 < var10.length; ++var19) {
                  zit var13 = (zit)var10[var19].get(var17);
                  if (var17 == 0 || var16 || var19 == var10.length - 1 || var13.a != null && (!(var13.a instanceof String) || !"".equals((String)((String)var13.a)))) {
                     var16 = true;
                     zafr var20;
                     if (var19 == 0) {
                        var20 = var3.a(var13.a);
                     } else {
                        var14 = var11[var19 - 1];
                        var15 = (zafr)var14.get(var14.size() - 1);
                        var20 = var15.d().a(var13.a);
                     }

                     var20.c(var13.e);
                     var20.a(var13.c);
                     if (var13.g == 1) {
                        var20.b(var13.f);
                     }

                     if (var13.b != 0) {
                        var20.a(this.g.getSettings().e().d(var13.b));
                     }

                     com.aspose.cells.b.a.a.ze.a(var11[var19], (Object)var20);
                  }
               }
            }

            return var11;
         }
      } else {
         return null;
      }
   }

   private boolean a(ArrayList var1) {
      for(int var2 = 0; var2 < var1.size(); ++var2) {
         zit var3 = (zit)var1.get(var2);
         if ((!this.b.getPlotVisibleCells() || var3.d) && !var3.e && var3.g == 5 && !var3.a().equals("")) {
            return true;
         }
      }

      return false;
   }

   private void l() {
      if (this.b.getNSeries().getCount() != 0) {
         ArrayList var1 = new ArrayList();
         Iterator var2;
         if (this.i) {
            var2 = this.b.m().iterator();

            label97:
            while(var2.hasNext()) {
               ziz var3 = (ziz)var2.next();
               Iterator var4 = this.b.getNSeries().iterator();

               while(true) {
                  Series var5;
                  do {
                     do {
                        if (!var4.hasNext()) {
                           continue label97;
                        }

                        var5 = (Series)var4.next();
                     } while(!var5.t());
                  } while(var5.s() != var3);

                  boolean var6 = false;
                  if (var5.z() >= 0) {
                     for(int var7 = 0; var7 < var1.size(); ++var7) {
                        Series var8 = (Series)var1.get(var7);
                        if (var5.z() < var8.z()) {
                           var1.add(var7, var5);
                           var6 = true;
                           break;
                        }
                     }
                  }

                  if (!var6) {
                     com.aspose.cells.b.a.a.ze.a(var1, (Object)var5);
                  }
               }
            }
         } else {
            var2 = this.b.getNSeries().iterator();

            while(var2.hasNext()) {
               Series var10 = (Series)var2.next();
               if (var10.t()) {
                  com.aspose.cells.b.a.a.ze.a(var1, (Object)var10);
               }
            }
         }

         boolean var9 = false;
         boolean var11 = false;
         boolean var12 = true;
         boolean var13 = true;
         Iterator var14 = var1.iterator();

         while(var14.hasNext()) {
            Series var15 = (Series)var14.next();
            if (var15.m() == null) {
               if (var15.getPlotOnSecondAxis()) {
                  var11 = true;
               } else {
                  var9 = true;
               }
            } else {
               boolean[] var16;
               if (var15.getPlotOnSecondAxis()) {
                  if (!var11 && !ChartCollection.l(var15.getType())) {
                     var16 = new boolean[]{var13};
                     this.a(true, var15.m(), this.c.A().b(), var16);
                     var13 = var16[0];
                     var11 = true;
                  }
               } else if (!var9 && !ChartCollection.l(var15.getType())) {
                  var16 = new boolean[]{var12};
                  this.a(false, var15.m(), this.c.A().a(), var16);
                  var12 = var16[0];
                  var9 = true;
               }

               if (var11 && var9) {
                  return;
               }
            }
         }

      }
   }

   private String a(Series var1) {
      if (var1.k() != null) {
         if (var1.k() instanceof String) {
            return var1.getName();
         }

         if ((this.h || this.j) && var1.b != null) {
            return var1.b;
         }

         boolean var2 = false;
         zik var3 = zin.a(var1.i(), var1.j());
         var3.a((byte[])((byte[])var1.k()));
         boolean[] var4 = new boolean[]{var2};
         ArrayList var5 = var3.a(false, this.h || this.j, var4);
         var2 = var4[0];
         if (var2) {
            if (var1.b != null) {
               return var1.b;
            }
         } else if (var5 != null && var5.size() != 0) {
            String var6 = "";

            for(int var7 = 0; var7 < var5.size(); ++var7) {
               zit var8 = (zit)var5.get(var7);
               String var9 = this.a(var8);
               if ("".equals(var9)) {
                  if (var6.length() > 0 && var6.charAt(var6.length() - 1) != ' ') {
                     var6 = var6 + " ";
                  }
               } else {
                  var6 = var6 + var9;
               }

               if (var7 != var5.size() - 1 && var6.length() > 0 && var6.charAt(var6.length() - 1) != ' ') {
                  var6 = var6 + " ";
               }
            }

            return var6;
         }
      }

      return null;
   }

   String a(zit var1) {
      switch(var1.g) {
      case 1:
         if (var1.a != null && !"".equals(var1.a())) {
            double var2 = 0.0D;

            try {
               var2 = (Double)var1.a;
            } catch (Exception var7) {
               return var1.a();
            }

            String var4 = null;
            var4 = var1.c;
            if ((var4 == null || "".equals(var4)) && var1.b != 0) {
               var4 = this.g.getSettings().e().d(var1.b);
            }

            DateTime var5 = CellsHelper.getDateTimeFromDouble(var2, this.b.getWorksheet().getWorkbook().getSettings().getDate1904());
            if (var4 != null && "".equals(var4)) {
               var4 = null;
            }

            zxz var6 = this.g.getSettings().e().a(var4, var5, false);
            return var6.h();
         }

         return var1.a();
      default:
         if (var1.a != null && !"".equals(var1.a())) {
            String var8 = null;
            var8 = var1.c;
            if ((var8 == null || "".equals(var8)) && var1.b != 0) {
               var8 = this.g.getSettings().e().d(var1.b);
            }

            if (var8 != null && "".equals(var8)) {
               var8 = null;
            }

            zxz var3 = this.g.getSettings().e().a(var8, var1.a, false);
            return var3.h();
         } else {
            return var1.a();
         }
      }
   }

   private boolean a(zit var1, double[] var2) {
      switch(var1.g) {
      case 0:
         try {
            var2[0] = com.aspose.cells.b.a.ze.g(var1.a);
         } catch (Exception var4) {
            var2[0] = 0.0D;
         }

         return true;
      case 1:
      case 4:
         if (!"".equals(var1.a())) {
            var2[0] = com.aspose.cells.b.a.ze.g(var1.a);
            return true;
         }

         var2[0] = 0.0D;
         return false;
      case 2:
      case 5:
      case 6:
         var2[0] = 0.0D;
         return true;
      case 3:
         var2[0] = 0.0D;
         return false;
      default:
         var2[0] = 0.0D;
         return true;
      }
   }

   private void a(Workbook var1) {
      if (this.i) {
         zns[] var2 = var1.c.e;
         Color[] var3 = new Color[12];

         for(int var4 = 0; var4 < var3.length && var4 < var2.length; ++var4) {
            var3[var4] = var2[var4].a();
         }

         this.c.a(var3);
      } else {
         new com.aspose.cells.b.a.a.zd();
         com.aspose.cells.b.a.a.zd var11 = var1.getWorksheets().m().b();
         Color[] var12 = new Color[var11.b() - 8];
         int var5 = 0;

         int var6;
         int var7;
         int var8;
         int var9;
         int var10;
         for(var6 = 24; var6 < var11.b(); ++var6) {
            var7 = (Integer)var11.d((Object)var6);
            var8 = var7 & 255;
            var9 = (var7 & '\uff00') >> 8;
            var10 = (var7 & 16711680) >> 16;
            var12[var5++] = Color.fromArgb(var8, var9, var10);
         }

         for(var6 = 8; var6 < 24; ++var6) {
            var7 = (Integer)var11.d((Object)var6);
            var8 = var7 & 255;
            var9 = (var7 & '\uff00') >> 8;
            var10 = (var7 & 16711680) >> 16;
            var12[var5++] = Color.fromArgb(var8, var9, var10);
         }

         this.c.a(var12);
      }

   }

   private void a(Marker var1, zahh var2) throws Exception {
      if (!var1.a) {
         var2.a((int)((float)(var1.getMarkerSize() * this.g.getWorksheets().L()) / 72.0F + 0.5F));
      }

      var2.b(zjm.c(var1.getMarkerStyle()));
      Line var3 = var1.c();
      if (var3 != null) {
         this.a(var3, var2.b());
      }

      Area var4 = var1.b();
      if (var4 != null) {
         this.a(var4, var2.a());
      }

   }

   private void a(DropBars var1, zagc var2) throws Exception {
      if (var1.b() != null) {
         this.a(var1.getArea(), var2.e());
      }

      if (var1.a() != null) {
         this.a(var1.getBorder(), var2.g());
      }

   }

   private ArrayList a(Series var1, zik var2) {
      boolean var3 = false;
      boolean[] var4 = new boolean[]{var3};
      ArrayList var5 = var2.a(true, this.h || this.j, var4);
      var3 = var4[0];
      ArrayList var6 = new ArrayList();
      int var7;
      Object var8;
      if (var5.size() == 1) {
         var7 = var1.getPoints().getCount();
         var8 = ((zit)var5.get(0)).a;

         for(int var9 = 0; var9 < var7; ++var9) {
            com.aspose.cells.b.a.a.ze.a(var6, var8);
         }
      } else {
         for(var7 = 0; var7 < var5.size(); ++var7) {
            var8 = ((zit)var5.get(var7)).a;
            com.aspose.cells.b.a.a.ze.a(var6, var8);
         }
      }

      return var6;
   }

   private void a(ErrorBar var1, zagq var2) {
      var2.b(zjm.k(var1.getType()));
      var2.a(var1.getAmount());
      var2.a(zjm.j(var1.getDisplayType()));
      if (var1.getType() == 0) {
         zik var3;
         ArrayList var4;
         if ((var1.getDisplayType() == 0 || var1.getDisplayType() == 1) && var1.c() != null) {
            var3 = var1.c();
            if (var3.g()) {
               var2.b(1);
            } else {
               var4 = this.a(var1.d(), var3);
               if (var4 != null) {
                  var2.a(var4.toArray());
               }
            }
         }

         if ((var1.getDisplayType() == 0 || var1.getDisplayType() == 1) && var1.b() != null) {
            var3 = var1.b();
            if (var3.g()) {
               var2.b(1);
            } else {
               var4 = this.a(var1.d(), var3);
               if (var4 != null) {
                  var2.b(var4.toArray());
               }
            }
         }
      }

      var2.a(var1.a());
      var2.b(var1.getShowMarkerTTop());
      this.a((Line)var1, (zahf)var2.b());
   }

   private void a(DataLabels var1, zagn var2, int var3) throws Exception {
      if (var1.isDeleted()) {
         var2.c("");
      } else {
         if (!var1.isAutoText()) {
            if (var1.getText() == null) {
               var2.c("");
            } else {
               var2.c(var1.getText());
               boolean var4 = false;
               ArrayList var5 = null;
               DataLabels var6 = null;
               int var7 = -1;
               if (var1.L() instanceof ChartPoint) {
                  ChartPoint var8 = (ChartPoint)var1.L();
                  var6 = var8.a().getDataLabels();
                  var7 = var8.a;
               }

               if (var6 != null && var6.n != null) {
                  boolean[] var17 = new boolean[]{var4};
                  var5 = var6.n.a(false, false, var17);
                  var4 = var17[0];
               }

               if (var1.a() != null) {
                  boolean var18 = false;
                  if (var1.a().size() > 1) {
                     var18 = this.a(var1.a(), var1.getText(), var2.u());
                     if (var5 != null && var7 >= 0 && var7 < var5.size()) {
                        for(int var9 = 0; var9 < var2.u().getCount(); ++var9) {
                           zahp var10 = var2.u().a(var9);
                           if (var10.a().indexOf("[CELLRANGE]") >= 0) {
                              zit var11 = (zit)var5.get(var7);
                              var10.a(com.aspose.cells.b.a.zv.a(var10.a(), "[CELLRANGE]", var11.a()));
                           }
                        }
                     }
                  }

                  if (var18 || var1.a().size() == 1) {
                     FontSetting var19 = (FontSetting)var1.a().get(0);
                     var2.b().a(this.a(var19.getFont()));
                     if (!var19.getFont().getColor().isEmpty()) {
                        if (var19.getFont().getColor().getA() == 0) {
                           var2.b().a(Color.fromArgb(var19.getFont().getColor().toArgb() | -16777216));
                        } else {
                           var2.b().a(var19.getFont().getColor());
                        }
                     }
                  }
               }
            }
         }

         var2.a(var1.getShowCategoryName());
         var2.b(var1.getShowLegendKey());
         var2.c(var1.getShowPercentage());
         var2.e(var1.getShowSeriesName());
         var2.d(var1.getShowValue());
         var2.f(var1.getShowBubbleSize());
         var2.a(var1.getSeparatorValue());
         DataLabels var12 = null;
         Object var13 = var1.L();
         if (var13 instanceof ChartPoint) {
            var12 = ((ChartPoint)var13).a().getDataLabels();
         }

         if (var1.r) {
            if (var12 != null && !var12.r) {
               var2.a(zjm.m(var12.getPosition()));
            } else {
               var2.a(this.a(var3));
            }
         } else {
            var2.a(zjm.m(var1.getPosition()));
         }

         this.a((ChartFrame)var1, (zagc)var2.b());
         if (var1.g() == null && var1.h() == -1 && var1.L() != null && var1.L() instanceof ChartPoint) {
            ChartPoint var14 = (ChartPoint)var1.L();
            Series var16 = var14.a();
            if (var16.getDataLabels().g() != null || var16.getDataLabels().h() != -1) {
               var2.b().a(this.a(var16.getDataLabels().getFont()));
               if (!var16.getDataLabels().getFont().getColor().isEmpty()) {
                  if (var16.getDataLabels().getFont().getColor().getA() == 0) {
                     var2.b().a(Color.fromArgb(var16.getDataLabels().getFont().getColor().toArgb() | -16777216));
                  } else {
                     var2.b().a(var16.getDataLabels().getFont().getColor());
                  }
               }
            }
         }

         var2.h(var1.getNumberFormatLinked());
         if (!var1.getNumberFormatLinked()) {
            if (var1.getNumber() != 0) {
               var2.b(this.g.getSettings().e().d(var1.getNumber()));
            } else if (var1.getNumberFormat() != null && !"".equals(var1.getNumberFormat())) {
               var2.b(var1.getNumberFormat());
               int var15 = this.b(var2.p());
               if (var15 != 0) {
                  var2.b(this.g.getSettings().e().d(var15));
               }
            }
         }

         var2.c(var1.getRotationAngle());
         var2.d(zjm.o(var1.getTextHorizontalAlignment()));
         var2.e(zjm.o(var1.getTextVerticalAlignment()));
         var2.g(var1.A());
         var2.f(var1.getTextDirection());
         if (var1.s()) {
            var2.b().b(true);
            var2.b().c(var1.getX());
            var2.b().d(var1.getY());
            var2.b().a(var1.getWidth());
            var2.b().b(var1.getHeight());
         } else if (var1.t()) {
            var2.b().b(false);
            var2.b().c(var1.u());
            var2.b().d(var1.v());
         }

         var2.i(var1.isTextWrapped());
      }
   }

   boolean a(ArrayList var1, String var2, zahq var3) throws Exception {
      boolean var4 = true;
      Color var5 = Color.getEmpty();
      com.aspose.cells.b.a.b.zg var6 = null;

      for(int var7 = 0; var7 < var1.size(); ++var7) {
         FontSetting var8 = (FontSetting)var1.get(var7);
         String var9 = var2.substring(var8.getStartIndex(), var8.getStartIndex() + var8.getLength());
         com.aspose.cells.b.a.b.zg var10 = this.a(var8.getFont());
         zxp var11 = this.c(var8.getFont());
         if (var7 == 0) {
            var6 = var10;
            var5 = var8.getFont().getColor();
         } else if (var4) {
            if (!this.a(var6, var10) || !this.a(var5, var8.getFont().getColor())) {
               var4 = false;
            }

            if (this.b(var8.getFont()) || this.a(var9)) {
               var4 = false;
            }
         }

         Color var12 = Color.a(255, (Color)var8.getFont().getColor());
         ArrayList var13 = zbuk.a(var9, var8.getFont(), false);
         zbam var14 = new zbam();
         zbuk.a(var13, var14, var10, var12, var11);
         if (var13.size() > 0) {
            for(int var15 = 0; var15 < var13.size(); ++var15) {
               var3.a(var14.a(var15).a(), var14.a(var15).b(), var14.a(var15).c(), var14.a(var15).d(), 2);
            }
         } else {
            var3.a(var9, var10, var12, var11, 2);
         }
      }

      if (var4) {
         var3.clear();
      }

      return var4;
   }

   private boolean a(Color var1, Color var2) {
      if (var1.getR() != var2.getR()) {
         return false;
      } else if (var1.getG() != var2.getG()) {
         return false;
      } else {
         return var1.getB() == var2.getB();
      }
   }

   private boolean a(String var1) {
      if (var1.indexOf("[SERIES NAME]") >= 0) {
         return true;
      } else if (var1.indexOf("[CATEGORY NAME]") >= 0) {
         return true;
      } else if (var1.indexOf("[VALUE]") >= 0) {
         return true;
      } else if (var1.indexOf("[CELLRANGE]") >= 0) {
         return true;
      } else {
         return var1.indexOf("[PERCENTAGE]") >= 0;
      }
   }

   private int a(int var1) {
      switch(var1) {
      case 0:
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
      case 7:
      case 8:
      case 10:
      case 11:
      case 15:
      case 16:
      case 19:
      case 20:
      case 22:
      case 23:
      case 25:
      case 26:
      case 29:
      case 30:
      case 32:
      case 33:
      case 35:
      case 36:
      case 51:
      case 52:
      case 54:
      case 55:
         return 1;
      case 6:
      case 9:
      case 14:
      case 17:
      case 18:
      case 21:
      case 24:
      case 27:
      case 28:
      case 31:
      case 34:
      case 50:
      case 53:
      case 56:
         return 4;
      case 12:
      case 13:
      case 37:
      case 38:
      case 39:
      case 40:
      case 41:
      case 42:
      case 43:
      case 60:
      case 61:
      case 62:
      case 63:
      case 64:
         return 8;
      case 44:
      case 45:
      case 46:
      case 47:
      case 48:
      case 49:
         return 0;
      case 57:
      case 58:
      case 59:
      default:
         return 1;
      }
   }

   private boolean g(Chart var1) {
      switch(var1.getType()) {
      case 3:
      case 17:
      case 27:
      case 34:
      case 43:
      case 56:
         return true;
      default:
         return false;
      }
   }

   private double a(double var1) {
      if (var1 > 1.0D) {
         return var1;
      } else {
         int var3 = this.b(var1);
         if (var3 > 15) {
            double var4 = var1 * Math.pow(10.0D, (double)(var3 - 15 - 1));
            double var6 = com.aspose.cells.b.a.zq.b(var4, 15);
            double var8 = var6 * Math.pow(10.0D, (double)(16 - var3));
            return var8;
         } else {
            return var1;
         }
      }
   }

   private int b(double var1) {
      char var3 = com.aspose.cells.b.a.ze.a(com.aspose.cells.b.a.c.zc.a().c());
      int var4 = 1;
      String var5 = "";
      String var6 = com.aspose.cells.b.a.zn.b(var1);
      int var7 = var6.indexOf("E");
      int var8 = var6.indexOf("e");
      int var10;
      if (var7 > 0 || var8 > 0) {
         String[] var9;
         if (var7 > 0) {
            var9 = com.aspose.cells.b.a.zv.d(var6, 'E');
         } else {
            var9 = com.aspose.cells.b.a.zv.d(var6, 'e');
         }

         if (var9[0].charAt(0) == '-') {
            var9[0] = var9[0].substring(1);
         }

         var10 = var9[0].indexOf(var3);
         int var11 = Math.abs(com.aspose.cells.b.a.ze.f(var9[1]));
         int var12;
         if (var10 > 0) {
            var5 = var9[0].substring(0, 0 + var10) + var9[0].substring(var10 + 1);
            if (var9[1].charAt(0) != '-') {
               while(var11 > 0) {
                  var5 = var5 + "0";
                  --var11;
               }
            } else {
               var12 = var11 - (var10 - 1);
               if (var12 <= 0) {
                  if (var12 < 0) {
                     var5 = var5.substring(0, 0 + var10 + var12) + var3 + var5.substring(var10 + var12);
                  }
               } else {
                  while(var12 > 0) {
                     var5 = "0" + var5;
                     --var12;
                  }

                  var5 = Character.toString(var5.charAt(0)) + var3 + var5.substring(1);
               }
            }
         } else {
            var5 = var9[0];
            if (var9[1].charAt(0) != '-') {
               while(var11 > 0) {
                  var5 = var5 + "0";
                  --var11;
               }
            } else {
               var12 = var11 - (var5.length() - 1);
               if (var12 <= 0) {
                  if (var12 < 0) {
                     var5 = var5.substring(0, 0 + var5.length() + var12) + var3 + var5.substring(var5.length() + var12);
                  }
               } else {
                  while(var12 > 0) {
                     var5 = "0" + var5;
                     --var12;
                  }

                  var5 = Character.toString(var5.charAt(0)) + var3 + var5.substring(1);
               }
            }
         }

         var6 = var5;
      }

      int var13 = var6.indexOf(var3, 0);
      if (var13 > 0) {
         for(var10 = var13 + 1; var10 < var6.length(); ++var10) {
            ++var4;
         }
      }

      return var4;
   }

   private void a(DisplayUnitLabel var1, zagp var2) throws Exception {
      this.a((ChartFrame)var1, (zagc)var2.c());
      var2.d(zjm.o(var1.getTextHorizontalAlignment()));
      var2.e(zjm.o(var1.getTextVerticalAlignment()));
      var2.c(var1.getRotationAngle());
      var2.b(var1.A());
      var2.f(var1.getTextDirection());
      if (var1.getText() != null && !"".equals(var1.getText())) {
         var2.a(var1.getText());
      }

      if (var1.s()) {
         var2.c().b(true);
         var2.c().c(var1.getX());
         var2.c().d(var1.getY());
         var2.c().a(var1.getWidth());
         var2.c().b(var1.getHeight());
      } else if (var1.t()) {
         var2.c().b(false);
         var2.c().c(var1.u());
         var2.c().d(var1.v());
      }

   }

   private void a(Axis var1, TickLabels var2, zaif var3) throws Exception {
      if (var2.a() != null || var2.b() != -1) {
         var3.a(this.a(var2.getFont()));
         if (!var2.getFont().getColor().isEmpty()) {
            var3.a(this.a(var2.getFont().getColor()));
         }
      }

      var3.a(var2.getNumberFormatLinked());
      if (!var2.getNumberFormatLinked()) {
         int var4 = var2.getNumber();
         String var5 = var2.getNumberFormat();
         if (var4 != 0) {
            var3.a(this.g.getSettings().e().d(var4));
         } else if (var5 != null && !"".equals(var5)) {
            var3.a(var5);
            int var6 = this.b(var3.b());
            if (var6 != 0) {
               var3.a(this.g.getSettings().e().d(var6));
            }
         }
      }

      var3.a(var2.getOffset());
      if (!var2.c()) {
         var3.b(var2.getRotationAngle());
      }

      var3.b(var2.e());
      var3.c(var2.getTextDirection());
   }

   private void a(ChartFrame var1, zagc var2) throws Exception {
      this.a(var1.getBorder(), var2.g());
      this.a(var1.getArea(), var2.e());
      if (var1.g() != null || var1.h() != -1) {
         var2.a(this.a(var1.getFont()));
         if (this.b(var1.getFont())) {
            this.a(var1.getFont(), var2.k());
         }

         if (!var1.getFont().b.a() && !var1.getFont().getColor().isEmpty()) {
            if (var1.getFont().getColor().getA() == 0) {
               var2.a(Color.fromArgb(var1.getFont().getColor().toArgb() | -16777216));
            } else {
               var2.a(var1.getFont().getColor());
            }
         }
      }

      if (!var1.i() || !var1.l()) {
         var2.a(false);
         var2.c(var1.m());
         var2.d(var1.n());
         var2.a(var1.getWidth());
         var2.b(var1.getHeight());
      }

   }

   private void a(Title var1, zaig var2, boolean var3) throws Exception {
      this.a(var1.getBorder(), var2.a().g());
      this.a(var1.getArea(), var2.a().e());
      if (var1.g() == null && var1.h() == -1) {
         if (this.i && (var1.getChart().getChartArea().g() == null || var1.getChart().getChartArea().h() == -1)) {
            var2.a().a(this.a(var1.getFont()));
         }
      } else {
         var2.a().a(this.a(var1.getFont()));
         if (!var1.getFont().b.a() && !var1.getFont().getColor().isEmpty()) {
            if (var1.getFont().getColor().getA() == 0) {
               var2.a().a(Color.fromArgb(var1.getFont().getColor().toArgb() | -16777216));
            } else {
               var2.a().a(var1.getFont().getColor());
            }
         }
      }

      if (this.i) {
         if (!var1.i()) {
            var2.a().c(var1.m());
            var2.a().d(var1.n());
         }

         var2.a().b(var1.b() || var1.c());
         var2.a(var1.getOverLay());
      } else if (!var1.i()) {
         if (var1.s()) {
            var2.a().b(true);
            var2.a().c(var1.getX());
            var2.a().d(var1.getY());
         } else if (var1.t()) {
            var2.a().b(false);
            var2.a().c(var1.u());
            var2.a().d(var1.v());
         }
      }

      var2.a().e(true);
      var2.a(var1.getRotationAngle());
      if (var1.isAutoText()) {
         if (var3) {
            if (this.i) {
               if ((this.b.getNSeries().getCount() == 1 || ChartCollection.c(this.b.getType())) && this.b.getNSeries().get(0).getName() != null) {
                  String var4 = this.a(this.b.getNSeries().get(0));
                  if (var4 != null) {
                     this.c.L().a(var4);
                  } else {
                     var2.a("Chart Title");
                  }
               } else {
                  var2.a("Chart Title");
               }
            }
         } else if (var1.v != null) {
            var2.a("Axis Title");
         }
      } else if (var2.b() == null) {
         var2.a("");
      } else {
         var2.a(var1.getText());
         if (var1.D() != null) {
            boolean var6 = false;
            if (var1.D().size() > 1) {
               var6 = this.a(var1.D(), var1.getText(), var2.d());
            }

            if (var6 || var1.D().size() == 1) {
               FontSetting var5 = (FontSetting)var1.D().get(0);
               var2.a().a(this.a(var5.getFont()));
               if (!var5.getFont().getColor().isEmpty()) {
                  if (var5.getFont().getColor().getA() == 0) {
                     var2.a().a(Color.fromArgb(var5.getFont().getColor().toArgb() | -16777216));
                  } else {
                     var2.a().a(var5.getFont().getColor());
                  }
               }
            }
         }
      }

      var2.b(zjm.o(var1.getTextHorizontalAlignment()));
      var2.c(zjm.o(var1.getTextVerticalAlignment()));
      var2.b(var1.F());
      var2.d(var1.getTextDirection());
      if (var2.d().getCount() == 0) {
         ArrayList var7 = zbuk.a(var2.b(), var1.getFont(), false);
         zbuk.a(var7, var2.d(), var2.a().h(), var2.a().j(), var2.a().k());
      }

   }

   private com.aspose.cells.b.a.b.zg a(Font var1) throws Exception {
      int var2 = 0;
      if (var1.isBold()) {
         var2 |= 1;
      }

      if (var1.isItalic()) {
         var2 |= 2;
      }

      if (var1.isStrikeout()) {
         var2 |= 8;
      }

      if (var1.getUnderline() != 0) {
         var2 |= 4;
      }

      double var3 = var1.getDoubleSize();
      String var5 = var1.getName();

      try {
         return new com.aspose.cells.b.a.b.zg(var5, (float)var3, var2);
      } catch (Exception var8) {
         com.aspose.cells.a.d.zfq var7 = com.aspose.cells.a.d.zfs.b(var5, var2, false);
         return new com.aspose.cells.b.a.b.zg(var1.getName(), (float)var3, var7.g());
      }
   }

   private boolean a(com.aspose.cells.b.a.b.zg var1, com.aspose.cells.b.a.b.zg var2) {
      if (!com.aspose.cells.b.a.zv.b(var1.g(), var2.g())) {
         return false;
      } else if (var1.h() != var2.h()) {
         return false;
      } else if (var1.c() != var2.c()) {
         return false;
      } else if (var1.f() != var2.f()) {
         return false;
      } else if (var1.j() != var2.j()) {
         return false;
      } else {
         return var1.l() == var2.l();
      }
   }

   private boolean b(Font var1) {
      if ((var1.isSubscript() || var1.isSuperscript()) && var1.getScriptOffset() != 0.0D) {
         return true;
      } else if (var1.getCapsType() != 0) {
         return true;
      } else {
         return var1.isNormalizeHeights();
      }
   }

   private zxp c(Font var1) {
      zxp var2 = new zxp();
      var2.a(var1.isStrikeout());
      var2.b(var1.getStrikeType() == 1);
      var2.c(var1.isSuperscript());
      var2.d(var1.isSubscript());
      var2.a(var1.getScriptOffset());
      var2.e(var1.getCapsType() == 2);
      var2.f(var1.getCapsType() == 1);
      var2.g(var1.isNormalizeHeights());
      return var2;
   }

   private void a(Font var1, zagt var2) {
      var2.a(var1.isStrikeout());
      var2.b(var1.getStrikeType() == 1);
      var2.c(var1.isSuperscript());
      var2.d(var1.isSubscript());
      var2.a(var1.getScriptOffset());
      var2.e(var1.getCapsType() == 2);
      var2.f(var1.getCapsType() == 1);
      var2.g(var1.isNormalizeHeights());
   }

   private void a(Line var1, zahf var2) {
      if (var1 != null) {
         if (!var1.isVisible()) {
            var2.a(0);
         } else if (var1.isAuto()) {
            var2.a(1);
         } else {
            var2.a(zjm.s(var1.getFormattingType()));
            if (var1.getColor().isEmpty()) {
               var2.a(true);
            } else {
               var2.a(false);
               var2.a(this.a(var1.getColor(), var1.h()));
            }

            if (this.i) {
               if (var1.j()) {
                  var2.b().a(var1.getWeightPt() * (double)this.b.j().L() / 72.0D);
               }

               var2.b().a(zjm.w(var1.getCompoundType()));
               var2.b().b(zjm.t(var1.getDashType()));
               var2.b().c(zjm.x(var1.getCapType()));
               var2.b().d(zjm.y(var1.getJoinType()));
               var2.b().g(zjm.A(var1.getBeginArrowLength()));
               var2.b().e(zjm.z(var1.getBeginType()));
               var2.b().f(zjm.B(var1.getBeginArrowWidth()));
               var2.b().j(zjm.A(var1.getEndArrowLength()));
               var2.b().h(zjm.z(var1.getEndType()));
               var2.b().i(zjm.B(var1.getEndArrowWidth()));
               if (var1.getGradientFill() != null) {
                  this.a(var1.getGradientFill(), var2.d());
               }
            } else {
               var2.b().b(zjm.u(var1.getStyle()));
               var2.b().a((double)zjm.v(var1.getWeight()));
            }

         }
      }
   }

   private void a(Area var1, zafn var2) throws Exception {
      if (var1 != null) {
         var2.a(zjm.l(var1.getFormatting()));
         if (var1.getFormatting() == 2) {
            if (!var1.getBackgroundColor().isEmpty()) {
               var2.a(this.a(var1.getBackgroundColor(), var1.d()));
            }

            if (!var1.getForegroundColor().isEmpty()) {
               var2.b(this.a(var1.getForegroundColor(), var1.d()));
            }
         }

         if (var1.a()) {
            this.a(var1.getFillFormat(), var2);
         }

         var2.a(var1.getInvertIfNegative());
      }
   }

   private void a(FillFormat var1, zafn var2) throws Exception {
      zagr var3 = var2.d();
      switch(var1.getType()) {
      case 3:
         var2.a(3);
         this.a(var1.getGradientFill(), var3.d());
         break;
      case 4:
         if (var1.getTextureFill().getImageData() == null) {
            var2.a(0);
         } else {
            try {
               var2.a(4);
               byte[] var8 = var1.getTextureFill().getImageData();
               com.aspose.cells.b.a.d.zh var9 = new com.aspose.cells.b.a.d.zh(var8);
               com.aspose.cells.b.a.b.zj var6 = com.aspose.cells.b.a.b.zj.a((com.aspose.cells.b.a.d.zm)var9);
               this.a(var1, var1.getTextureFill(), var3.e());
               var3.e().a(var6);
            } catch (Exception var7) {
               var2.a(0);
            }
         }
         break;
      case 5:
         var2.a(5);
         if (var1.getPatternFill().getPattern() != 0 && var1.getPatternFill().getPattern() != 50) {
            Color var4 = this.a(var1.getPatternFill().getForegroundColor(), var1.getPatternFill().a());
            Color var5 = this.a(var1.getPatternFill().getBackgroundColor(), var1.getPatternFill().b());
            var3.a(var4, var5, zjm.b(var1.getPattern()));
         } else {
            var2.a(0);
         }
      }

   }

   private void a(GradientFill var1, zagx var2) {
      var2.a(var1.getAngle());
      var2.a(zjm.D(var1.getFillType()));
      var2.b(zjm.E(var1.getDirectionType()));

      for(int var3 = 0; var3 < var1.getGradientStops().getCount(); ++var3) {
         GradientStop var4 = var1.getGradientStops().get(var3);
         int var5 = var4.a.c(this.g);
         int var6 = var5 & 255;
         int var7 = (var5 & '\uff00') >> 8;
         int var8 = (var5 & 16711680) >> 16;
         Color.fromArgb(var4.a() * 255 / 100, var6, var7, var8);
         var6 = var4.getCellsColor().getColor().getR() & 255;
         var7 = var4.getCellsColor().getColor().getG() & 255;
         var8 = var4.getCellsColor().getColor().getB() & 255;
         Color var10 = Color.fromArgb(var4.a() * 255 / 100, var6, var7, var8);
         var2.d().a(var10, (float)var4.getPosition());
      }

   }

   private void a(FillFormat var1, TextureFill var2, zaid var3) {
      var3.a(var1.a());
      if (var2 != null) {
         var3.a(var2.isTiling());
         if (var2.isTiling()) {
            var3.a(var2.getTilePicOption().getOffsetX());
            var3.b(var2.getTilePicOption().getOffsetY());
            var3.c(var2.getTilePicOption().getScaleX());
            var3.d(var2.getTilePicOption().getScaleY());
            var3.b(zjm.F(var2.getTilePicOption().getAlignmentType()));
            var3.c(zjm.G(var2.getTilePicOption().getMirrorType()));
         } else {
            var3.d(zjm.H(var2.getPicFormatOption().getType()));
            var3.e(var2.getPicFormatOption().getLeft());
            var3.f(var2.getPicFormatOption().getRight());
            var3.g(var2.getPicFormatOption().getTop());
            var3.h(var2.getPicFormatOption().getBottom());
            var3.i(var2.getPicFormatOption().getScale());
         }

      }
   }

   private int b(String var1) {
      return "m/d/yyyy".equals(var1.toLowerCase()) ? 14 : 0;
   }

   private void a(zahv var1, Series var2) throws Exception {
      Iterator var3 = var2.getTrendLines().iterator();

      while(var3.hasNext()) {
         Trendline var4 = (Trendline)var3.next();
         int var5 = zjm.r(var4.getType());
         int var6 = var1.l().b(var5);
         zaih var7 = var1.l().a(var6);
         var7.c(var4.isNameAuto());
         if (!var4.isNameAuto()) {
            var7.a(var4.getName());
         }

         this.a((Line)var4, (zahf)var7.a());
         if (var5 == 4) {
            var7.a(var4.getOrder());
         } else if (var5 == 3) {
            var7.b(var4.getPeriod());
         }

         var7.b(var4.getForward());
         var7.a(var4.getBackward());
         this.a(var4.getDataLabels(), var7.b(), var2.getType());
         if (var4.c()) {
            var7.c(var4.getIntercept());
         }

         var7.a(var4.getDisplayEquation());
         var7.b(var4.getDisplayRSquared());
         var7.c(var4.d());
      }

   }

   private void a(Floor var1, zags var2) throws Exception {
      this.a((Area)var1, (zafn)var2.d());
      this.a(var1.getBorder(), var2.b());
   }

   private void a(Walls var1, zaij var2) throws Exception {
      this.a((Area)var1, (zafn)var2.b());
      this.a(var1.getBorder(), var2.a());
   }

   private Color a(Color var1, int var2) {
      return Color.a(var2 * 255 / 100, var1);
   }

   private Color a(Color var1) {
      return Color.fromArgb(255, var1.getR() & 255, var1.getG() & 255, var1.getB() & 255);
   }

   private boolean b(int var1) {
      switch(var1) {
      case 37:
      case 38:
      case 39:
      case 40:
      case 41:
      case 42:
      case 43:
      case 57:
      case 58:
      case 60:
      case 61:
      case 62:
      case 63:
      case 64:
         return true;
      case 44:
      case 45:
      case 46:
      case 47:
      case 48:
      case 49:
      case 50:
      case 51:
      case 52:
      case 53:
      case 54:
      case 55:
      case 56:
      case 59:
      default:
         return false;
      }
   }

   protected void finalize() throws Exception {
      this.a(false);
   }

   public void a() {
      this.a(true);
      com.aspose.cells.b.a.zg.a(this);
   }

   public void b() {
      this.a();
   }

   protected void a(boolean var1) {
      if (!this.k) {
         if (var1) {
            if (this.d != null) {
               this.d.ar();
            }

            if (this.e != null) {
               this.e.ar();
            }
         }

         this.k = true;
      }

   }
}
